<template>
  <div id="app">
    <div class="btn-group">
      <button v-if="isButtonVisible" class="nav-btn">
        <router-link exact active-class="active" to="/">正在热映</router-link>
      </button>
      <button v-if="isButtonVisible" class="nav-btn">
        <router-link active-class="active" to="/coming">即将上映</router-link>
      </button>
    </div>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      isButtonVisible: true
    };
  },
  watch: {
    $route(to, from) {
      if (to.name === 'ing') {
        this.isButtonVisible = false;
      } else {
        this.isButtonVisible = true;
      }
    }
  }
};
</script>

<style lang="less">
a {
  text-decoration: none;
}

.active {
  color: orangered;
}

.btn-group {
  display: flex;
  gap: 12px;
  padding: 16px;
  background-color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-btn {
  border: none;
  background-color: #f5f5f5;
  color: #333;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;

  &:hover {
    background-color: #e0e0e0;
    transform: translateY(-2px);
  }

  a {
    color: inherit;
  }

  &.active {
    background-color: orangered;
    color: #fff;

    &:hover {
      background-color: #d84315;
    }
  }
}
</style>